<!--$Id: txn_class.so,v 10.25 2005/05/17 15:25:50 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbTxn</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbTxn</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
class DbTxn {
public:
	DB_TXN *DbTxn::get_DB_TXN();
	const DB_TXN *DbTxn::get_const_DB_TXN() const;
	static DbTxn *DbTxn::get_DbTxn(DB_TXN *txn);
	static const DbTxn *DbTxn::get_const_DbTxn(const DB_TXN *txn);
	...
};
</pre></b>
<hr size=1 noshade>
<b>Description: DbTxn</b>
<p>The DbTxn object is the handle for a transaction.  Methods of
the DbTxn handle are used to configure, abort and commit the
transaction.  DbTxn handles are provided to <a href="../api_cxx/db_class.html">Db</a> methods
in order to transactionally protect those database operations.</p>
<p>DbTxn handles are not free-threaded; transactions handles may
be used by multiple threads, but only serially, that is, the application
must serialize access to the DbTxn handle.  Once the
<a href="../api_cxx/txn_abort.html">DbTxn::abort</a> or <a href="../api_cxx/txn_commit.html">DbTxn::commit</a> methods are called, the handle may
not be accessed again, regardless of the method's return. In addition,
parent transactions may not issue any Berkeley DB operations while they have
active child transactions (child transactions that have not yet been
committed or aborted) except for <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>, <a href="../api_cxx/txn_abort.html">DbTxn::abort</a>
and <a href="../api_cxx/txn_commit.html">DbTxn::commit</a>.</p>
<p>Each DbTxn object has an associated DB_TXN struct, which
is used by the underlying implementation of Berkeley DB and its C-language
API.  The DbTxn::get_DB_TXN method returns a pointer to this struct.
Given a const DbTxn object, DbTxn::get_const_DB_TXN returns a
const pointer to the same struct.</p>
<p>Given a DB_TXN struct, the Db::get_DbTxn method returns the
corresponding DbTxn object, if there is one.  If the
DB_TXN object was not associated with a DbTxn (that is,
it was not returned from a call to DbTxn::get_DB_TXN), then the result
of DbTxn::get_DbTxn is undefined.  Given a const DB_TXN struct,
DbTxn::get_const_DbTxn returns the associated const DbTxn
object, if there is one.</p>
<p>These methods may be useful for Berkeley DB applications including  both C
and C++ language software.  It should not be necessary to use these
calls in a purely C++ application.</p>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>, DbTxn
<br><b>See Also</b>
<a href="../api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
